import java.util.function.Supplier;

public class SupplierDemo2 {
    public static void main(String[] args) {
        int [] arr = {19,34,22,50,67};
        int maxValue  = getMax(()->{
            int max = arr[0];
            for(int i = 1; i < arr.length;i++){
                if(arr[i] > max)
                    max = arr[i];
            }
            return max;
        });
        System.out.println(maxValue);
    }
    private static int getMax(Supplier<Integer> sup){
        return sup.get();
    }
}
